package com;

import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import com.bean.Student;
import com.opensymphony.xwork2.ActionSupport;
import com.service.StudentService;


public class ViewStudents extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Collection<Student> students;

	@Autowired
	@Qualifier("studentService")
	private StudentService studentService;

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public Collection<Student> getStudents() {
		return students;
	}

	public void setStudents(Collection<Student> students) {
		this.students = students;
	}

	@Override
	public String execute() throws Exception {
		try
		{
			setStudents(studentService.allStudents());
			return SUCCESS;
		}
		catch (Exception e) 
		{
			e.printStackTrace();
			return ERROR;
		}
	}
	

}
